#include "number_edit.h"

NumberEdit::NumberEdit(QWidget *parent) : QLineEdit(parent) {
    setFixedWidth(50);
    setAlignment(Qt::AlignCenter);
}


void NumberEdit::keyPressEvent(QKeyEvent *pEvent) {
    int ch=pEvent->key();

    switch(ch) {
    case Qt::Key_Backspace:
    case Qt::Key_Period:
    case Qt::Key_Delete:
    case Qt::Key_Minus:
    case Qt::Key_0:
    case Qt::Key_1:
    case Qt::Key_2:
    case Qt::Key_3:
    case Qt::Key_4:
    case Qt::Key_5:
    case Qt::Key_6:
    case Qt::Key_7:
    case Qt::Key_8:
    case Qt::Key_9:
        QLineEdit::keyPressEvent(pEvent);
    default:
        pEvent->accept();


    }
}
